class Pipe:
    def __init__(self, id, callback):
        self.id = id
        self.callback = callback
    
    def Push(self, value):
        self.callback(self.id, value)

class PipePool:
    def __new__(cls):
        if not hasattr(cls, 'instance'):
            cls.instance = super(PipePool, cls).__new__(cls)
        return cls.instance
    pipes = []

    def New(self, callback):
        id = len(self.pipes)
        pipe = Pipe(id, callback)

        self.pipes.append(pipe)
        return id
    
    def AcessPipe(self, id):
        return self.pipes[id]
